<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>创建订单</title>
    <link rel="stylesheet" href="../home_code/all.css">
    <link rel="stylesheet" href="../home_code/head.css">
    <link rel="stylesheet" href="../home_code/creat.css">
    <link rel="stylesheet" href="../home_code/footer.css">
</head>



<body>
    <div class="head">
        <!-- 头部 -->
        <div class="logo"><a href="../homeUser.html"><img src="../../images/speed go.png" alt=""
                    style="width: 180px; height: 60px;"></a></div>
        <div class="nav">
            <ul>
                <li><a href="#">骑手招募</a></li>
                <li><a href="#">消息</a></li>
                <li><a href="#">下单</a></li>
                <li><a href="#">我的</a></li>
            </ul>
            <div class="headpicture"></div>
        </div>
    </div>
    <div class="main">
        <!-- 主体 -->
        <div class="price">
            <div class="title">
                订单费用
            </div>
            <div class="staff">
                <ul>
                    <li>预估耗时：--</li>
                    <li>订单总额：--</li>
                    <li>已优惠：--</li>
                    <li>您需支付：--</li>
                </ul>
            </div>
            <button type="button" class="publish">立即支付</button>
        </div>
        <div class="sender information" style="margin-top:110px;">
            <!-- 发送信息 -->
            <div class="title">订单发布</div>
            <form action="" method="POST" id="senderForm">
                <div class="ele">
                    <div>取  件 码</div><input type="text"  id="pickUpCode" value="123" >
                    <div>送达地址</div><input type="text"   id="receivedAddress"       value="请输入详细地址，例如楼层号，门牌号" >
<!--                    <div>送达时间</div><input type="date"   id="deliveryTime" value="">-->
                </div>
            </form>
        </div>
        <div class="addressee information">
            <form action="" method="POST" id="addressseeForm">
                <div class="ele">
                    <div>重量</div><input  type="number"  id="weight" value="千克">
                    <div>佣金</div><input type="number"  id="commission" value="" >
                </div>
            </form>
        </div>
    </div>

    <div class="footer">
        <!-- 底部 -->
        <div class="link">
            <ul>
                <li style="border-left:0;"><a href="#">客服</a></li>
                <li><a href="#">常见问题</a></li>
                <li><a href="#">关于我们</a></li>
            </ul>
        </div>
    </div>
    <script src="../../jQuery/jquery-3.6.0.js"></script>
    <script src="../home_code/creat.js"></script>


    <script>
    $('.publish').click(function(){
        var user = JSON.parse(localStorage.getItem("username"));
        var customerId = user.username;
        var pickUpCode = $("#pickUpCode").val();
        var receivedAddress = $("#receivedAddress").val();
        // var deliveryTime = $("#deliveryTime").val();
        var weight = $("#weight").val();
        var commission = $("#commission").val();
        $.ajax({
            type:"post",
            url:"/order/publish",
            dataType:'json',
            data:{"customerId": customerId,
                  "pickUpCode": pickUpCode,
                  "receivedAddress": receivedAddress,
                  "weight": weight,
                  "commission": commission} ,
            success : function(result){
                if (result.code == 200){
                    alert(result.msg)
                }else{
                    alert(result.msg)
                }
            }
        })
       })
      </script>

</body>

</html>